class WalletModelEntity {
  //收益金币 毛/角
  int? income;
  int? uid;

  //充值金币
  int? amount;
  int? performance;

  //充值金币
  int? money;
  int? consumption;
  String? id;
  int? takeOut;
  int? current;
  int? limit;
  int? maxLevel;
  String? nudeChatIncome;
  int? fruitCoin;
  int? proxyIncome;
  num? vidIncome;
  List<PrivilegeBean>? privilegeBeans;
  int? point;
  int? aiUndressFreeTimes;
  int? todayAiUndressFreeTimes;
  int? integral; //积分
  int? downloadCount; // 视频下载次数
  double? incomePot;
  int? todayAiFreeTimes;

  WalletModelEntity(
      {this.income,
      this.uid,
      this.amount,
      this.performance,
      this.money,
      this.consumption,
      this.id,
      this.takeOut,
      this.current,
      this.limit,
      this.nudeChatIncome,
      this.fruitCoin,
      this.proxyIncome,
      this.vidIncome,
      this.privilegeBeans,
      this.point,
      this.aiUndressFreeTimes,
      this.todayAiUndressFreeTimes,
      this.integral,
      this.incomePot,
      this.todayAiFreeTimes});

  WalletModelEntity.fromJson(Map<String, dynamic>? json) {
    json ??= {};
    point = json['point'];
    downloadCount = json['downloadCount'];
    income = json['income'];
    uid = json['uid'];
    amount = json['amount'];
    performance = json['performance'];
    money = json['money'];
    consumption = json['consumption'];
    id = json['id'];
    current = json['current'];
    limit = json['limit'];
    nudeChatIncome = json['nudeChatIncome'];
    fruitCoin = json['fruitCoin'];
    proxyIncome = json['proxyIncome'];
    vidIncome = json['vidIncome'];
    takeOut = json['takeOut'];
    maxLevel = json['maxLevel'];
    integral = json['integral'];
    todayAiFreeTimes = json['todayAiFreeTimes'];
    aiUndressFreeTimes = json["aiUndressFreeTimes"];
    todayAiUndressFreeTimes = json["todayAiUndressFreeTimes"];
    privilegeBeans = (json['privileges'] as List?)?.map((o) => PrivilegeBean.fromJson(o)).toList();
    if (json['incomePot'] is double) {
      incomePot = json['incomePot'];
    } else {
      try {
        incomePot = double.tryParse((json['incomePot'] ?? "0").toString());
      } catch (e) {}
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = {};
    data['income'] = income;
    data['uid'] = uid;
    data['amount'] = amount;
    data['performance'] = performance;
    data['money'] = money;
    data['proxyIncome'] = proxyIncome;
    data['vidIncome'] = vidIncome;
    data['consumption'] = consumption;
    data['id'] = id;
    data['takeOut'] = takeOut;
    data['maxLevel'] = maxLevel;
    data['nudeChatIncome'] = nudeChatIncome;
    data['fruitCoin'] = fruitCoin;
    data['integral'] = integral;
    data['integral'] = integral;
    data['aiUndressFreeTimes'] = aiUndressFreeTimes;
    data['todayAiUndressFreeTimes'] = todayAiUndressFreeTimes;
    return data;
  }
}

extension WithdrawCash on WalletModelEntity {
  //  收益总额
  int walletBalance() {
    return ((income ?? 0) * 100.0 + (incomePot ?? 0) * 100) ~/ 100;
  }
}

class PrivilegeBean {
  String? name;
  String? desc;
  int? icon;
  int? type;
  bool? enable;
  int? number;

  PrivilegeBean.fromJson(Map<String, dynamic>? json) {
    json ??= {};
    name = json['name'];
    desc = json['desc'];
    icon = json['icon'];
    type = json['type'];
    enable = json['enable'];
    number = json['number'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = {};
    data['name'] = name;
    data['desc'] = desc;
    data['icon'] = icon;
    data['type'] = type;
    data['enable'] = enable;
    data['number'] = number;
    return data;
  }
}
